{php include wl_template('common/header');}
<ul class="nav nav-tabs" >
<li {if $op == 'base'}class="active"{/if}><a href="{php echo web_url('member/coupon', array('op' => 'base'))}">基本设置</a></li>
{if $checkfunction['status']}		<li {if $op == 'group'}class="active"{/if}><a href="{php echo web_url('member/coupon', array('op' => 'group'))}">组优惠券</a></li>{/if}
	<!--<li class="ex-button"><a class="ex-b-lastA" target="_blank" href="http://doc.lexiangpingou.cn/pCard.html">图文说明</a></li>-->
</ul>
{if $op == 'base'}
	
	<div class="panel panel-default">
	<div class="panel-body table-responsive" style="padding: 0px;">
		<div class="main_bd">
        <div class="plugins_wrp">
            <dl>
                <dd>
                    <ul id="js_plugins">
						<li class="item_wrp" style="width: 100%;">
							<div class="plugin_item">
								<!--<div class="plugin_icon"><img src="{TG_URL_WRES}images/function/takeset.png"  style="cursor:pointer;"></div>-->
								<div  id="link-icon1" class="plugin_icon" >
									<div id="link-icon" style="display:none;width:100%;height:100%;position:absolute;background-color:rgba(0,0,0,0.3);cursor:pointer;">
										<img src="{TG_URL_WRES}images/3.svg"style="position:absolute;width:60%;left:20%;">
									</div>
									<img src="{TG_URL_WRES}images/function/takeset.png" style="cursor:pointer;">
								</div>
								<div class="plugin_status">
									<i class="access"></i>
									<span class="status_txt">
										{if $checkfunction['status']}	
											
										<div id="renewal" style="font-size:20px;margin-top:-30px;width: 60px;height:60px;border-radius:50%;font-weight:900;background-color:#ff5466;color:white;margin-right: -25px;text-align:center;line-height:60px;cursor:pointer;">续费</div>										
								
										<span style="display:block;margin-left:-70px;color:#888;font-size:14px;">截止日期：{php echo date('Y-m-d', $checkfunction['endtime'])}</span>
										
										{else}
										
										<div id="buyDaifu" style="font-size:20px;margin-top:-20px;width: 60px;height:60px;border-radius:50%;font-weight:900;background-color:#ff5466;color:white;margin-right: -25px;text-align:center;line-height:60px;cursor:pointer;">购买</div>
										{/if}
									</span>
								</div>
								<div class="plugin_content">
									<h3 class="title">{$_W['page']['title']}</h3>
									<p class="desc" style="    width: 100%;">
										启用自提设置功能后，能自定义设置商品门店自提运费，可以设置到店减运费模式。同时支持同一商品多门店模板，支持与快递运费、送货上门、送货时间共同搭配使用。
										
										
									</p>
								</div>
							</div>
						</li>
					</ul>
                </dd>
            </dl>
        </div>
    </div>
	</div>
</div>
{/if}
{if $op == 'group'}
<div class="clearfix coupon-list-top">
	<div class="search pull-right">
		<form class="form-inline" action='./index.php' method='get'>
			<input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="lexiangpingou" />
            <input type="hidden" name="do" value="member" />
            <input type="hidden" name="ac" value="coupon" />
            <input type="hidden" name="op" value="list"/>
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon"><i class="fa fa-search"></i></div>
					<input type="text" class="form-control" placeholder="搜索" name="keyword">
				</div>
			</div>
		</form>
	</div>
	<div><a href="{php echo web_url('member/coupon/create');}" class="btn btn-success">新建组优惠券</a></div>
</div>
<style>
table thead tr th, table tbody tr td {text-align: center; width: 10%;}
table thead tr th:last-child, table tbody tr td:last-child {text-align: right;}
</style>
<div class="panel panel-default">
	<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead>
			<tr>
				<th>组优惠券名称</th>
				
				<th style="width:180px;">操作</th>
			</tr>
			</thead>
			<tbody>
			{loop $tg_coupon_templates $coupon_template}
			<tr>
				<td >{$coupon_template['name']}</td>
				
				<td style="position:relative;">
					
					<a href="{php echo web_url('member/coupon/edit', array('id' => $coupon_template['id']))}">编辑</a>
					<a href="javascript:;" data-id="{$coupon_template['id']}"  data-url="{php echo web_app_url('member/coupon/group',array('id'=>$coupon_template['id']))}" id="js-copy{$coupon_template['id']}" class="js-copy">复制链接</a>
					
				</td>
			</tr>
			{/loop}
			</tbody>
		</table>
	</div>
</div>
{$pager}
<!--<style>
.inner__content {background: #eee none repeat scroll 0 0;border-top: 1px solid #dcdcdc;box-sizing: border-box;color: #666;margin-top: 10px;margin-bottom:10px;min-width: 100%;padding: 10px 5px;width: auto;text-align:center;}
</style>-->
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script>
$(function(){
	$('.fa-search').click(function() {
		$('.coupon-list-top').find('form').submit();
	});
	$('.js-disable').click(function(e) {
		e.stopPropagation();
		var $this = $(this);
		var op = "{$_GPC['op']}";
		var coupon_template_id = $this.data('coupon-template-id');
		var url = "{php echo web_url('member/activity/edit')}&id=" + coupon_template_id;
		var html = '<a href="'+ url +'">查看</a> - 已失效';
		util.nailConfirm(this, function(state) {
			if (!state) return;
			$.post("{php echo web_url('member/activity/disable')}", {id : coupon_template_id}, function(data) {
				
				if(!data.errno){
					if (op == 'on' || op == 'future') {
						$this.parent().parent().remove();
					};
					$this.parent().html(html);
				};
				util.tips(data.message);
			}, 'json');
		}, {html:'<div class="inner__content"><span style="color:red;font-size:12px;">失效后将导致该优惠券无法被领取和编辑</span></div>确定让这组优惠券失效?', placement:'left'});
	});
});
</script>
{/if}
{php include wl_template('common/footer');}
late('common/footer');}
